package com.esfak47.mediafetcher.app.service;

import com.esfak47.mediafetcher.core.event.Event;
import com.esfak47.mediafetcher.core.event.EventSender;
import com.google.common.eventbus.EventBus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author tony
 * @date 2018/5/5
 */
public class AppEventSender implements EventSender {

    public static EventBus eventBus;
    private final Logger logger = LoggerFactory.getLogger(AppEventSender.class);

    @Override
    public void send(Event event) {
        logger.info("receive event is {}", event);
        if (eventBus != null) {
            eventBus.post(event);
        }
    }
}
